[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
getcolor() Get the Current Drawing Color
#include <graphics.h>
int far getcolor(void);
getcolor() returns the current drawing color. The value returned is
actually an index into the palette which contains the exact color
information. Pixels on the screen are set to this value when lines
or figures are drawn.
Returns: The value of the current drawing color.
-------------------------------- Example ---------------------------------
The following statements draw three rectangles, the first in the
original drawing color. The color value is stored, the drawing color
is set to 'red' and the second rectangle is drawn. The drawing color
is restored to its original value and the third rectangle is drawn.
#include <graphics.h>
#include <conio.h>
int gdriver = DETECT;
int gmode;
main()
{
int whcolor;
initgraph(&gdriver,&gmode,"");
whcolor = getcolor();
rectangle(100,100,200,150);
setcolor(4);
rectangle(300,100,400,150);
setcolor(whcolor);
rectangle(100,250,200,300);
getch();
closegraph();
}
See Also:
getpalette()
getmaxcolor()
setcolor()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson